<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      >
    <!--Inicia la composicion de la pagina en la plantilla-->
    <ui:composition template="/resources/default/template/plantilla.xhtml">

        <!--Segmento que define el contenido del header-->
        <ui:define name="head">
            <f:loadBundle basename="user.login.label_es"  var="label" />
            <f:loadBundle basename="user.login.message_es" var="message" />
            <title><h:outputText value="#{label.title1}"/></title>
        </ui:define>

        <ui:define name="autocomplete"><ui:include src="../autocomplete/main.xhtml"/></ui:define>

        <ui:define   name="moduleTitle">#{label.title1}   #{user_login.usuario}  </ui:define>
        <!--Segmento que define el contenido de la pagina-->
        <ui:define name="content">
            <p:growl id="messages" showDetail="true"/>
            <h:form >  
                <!--NOMBRE-->
                <div class="field">
                    <h:outputText value="#{label.field1}" class="label"/>
                    <h:inputText value="#{user_login.nombre}" class="textfield" size="25" maxlength="50" required="#{param['required']=='true'}" requiredMessage="#{message.m6}"/>
                </div>
                <!--APELLIDO-->
                <div class="field">
                    <h:outputText value="#{label.field2}" class="label"/>
                    <h:inputText value="#{user_login.apellido}" class="textfield" size="25" maxlength="50" required="#{param['required']=='true'}" requiredMessage="#{message.m6}"/>
                </div>
                <!--USUARIO-->
                <div class="field">
                    <h:outputText value="#{label.field3}" class="label"/>
                    <h:inputText value="#{user_login.usuario}" class="textfield" size="25" maxlength="50" required="#{param['required']=='true'}" requiredMessage="#{message.m6}"/>
                    <h:outputText class="required" value="*"/>
                </div>
                <!--CLAVE-->
                <div class="field">
                    <h:outputText value="#{label.field4}" class="label"/>
                    <h:inputText value="#{user_login.clave}" class="textfield" size="15" maxlength="50" required="#{param['required']=='true'}" requiredMessage="#{message.m6}"/>
                </div>
                <!--COMPAÑIA-->
                <div class="field">
                    <h:outputLabel for="compania" value="#{label.field5}" class="label"/>
                    <h:selectOneMenu id="compania" value="#{user_login.id_compañia}" disabled="#{user_login.acceso()}"  required="#{param['required']=='true'}" requiredMessage="#{message.m6}">
                        <f:selectItems value="#{user_login.companyItemList}"/>  
                    </h:selectOneMenu>
                </div>
                <!--ROL-->
                <div class="field">
                    <h:outputText value="#{label.field6}" class="label" />
                    <h:selectOneRadio id="rol" value="#{user_login.idl_rol}" class="radioButton" disabled="#{user_login.accesoUpdate()}" >  
                        <f:selectItem    itemLabel="#{label.rol1}" itemValue="1"  itemDisabled="#{user_login.acceso()}"  />  
                        <f:selectItem itemLabel="#{label.rol2}" itemValue="2"   />  
                        <f:selectItem itemLabel="#{label.rol3}" itemValue="3" />  
                    </h:selectOneRadio> 
                </div>
                <!--FECHA DE INICIO DE SESION-->
                <div class="field">
                    <h:outputText value="#{label.field7}" class="label"/>
                    <p:calendar value="#{user_login.login}" disabled="true" pattern="dd/MM/yy HH:mm:ss" />
                </div>
                <!--FECHA DE CIERRE DE SESION-->
                <div class="field">
                    <h:outputText value="#{label.field8}" class="label"/>
                    <p:calendar value="#{user_login.unLogin}" disabled="true" pattern="dd/MM/yy HH:mm:ss" />  
                </div>
                <!--FECHA DE REGISTRO-->
                <div class="field">
                    <h:outputText value="#{label.field9}" class="label"/>
                    <p:calendar value="#{user_login.registrado}" disabled="true" pattern="dd/MM/yy HH:mm:ss" />  
                </div>
                <!--ACTIVO-->
                <div class="field">
                    <h:outputText value="#{label.field10}" class="label"/>
                    <h:selectBooleanCheckbox value="#{user_login.activo}" class="checkBox" disabled="#{user_login.accesoUpdate()}"/>
                </div>

                <h:commandButton value="#{label.button1}" class="button"   actionListener="#{user_login.insert()}" 
                                 onclick="return verificar('#{message.m7}')" rendered="#{user_login.accesoRendered()}">
                    <f:param name="required" value="true"/>
                </h:commandButton>

                <h:commandButton value="#{label.button2}" class="button" actionListener="#{user_login.update}" onclick="return verificar('#{message.m7}')">
                    <f:param name="required" value="true"/>
                </h:commandButton>


                <h:commandButton value="#{label.button3}" class="button" 
                                 actionListener="#{user_login.delete}" 
                                 onclick="return verificar('#{message.m9}')" rendered="#{user_login.accesoRendered()}"  />

                <h:commandButton value="#{label.button4}" class="button" actionListener="#{user_login.clear}"/>

            </h:form>
        </ui:define>
    </ui:composition>
</html>